import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { HydratedDocument } from 'mongoose';
import { BaseEntity } from 'src/common/schema/baseEntity.schema';

export type UploadDocument = HydratedDocument<Upload>;

@Schema({
  collection: 'upload', // 指定集合名称
  timestamps: {
    currentTime: () => Date.now(),
    createdAt: 'createTime',
    updatedAt: 'updateTime',
  },
})
export class Upload extends BaseEntity {
  @Prop()
  fieldname: string; //file
  @Prop()
  originalname: string; //屏幕截图 2025-02-02 192400.png
  @Prop()
  encoding: string; //7bit
  @Prop()
  mimetype: string; //image/png
  @Prop()
  filename: string; //1739839844170.png
  @Prop()
  size: number //1325136
}

export const UploadSchema = SchemaFactory.createForClass(Upload);
